<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>发票管理</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__PUBLIC__/Theme1/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/animate.min.css" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/style.min.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>修改发票
                        <small></small>
                    </h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form method="post" action="__URL__/save" class="form-horizontal" enctype="multipart/form-data">
                        <input type="hidden" value="{$result.invoice_id}" name="invoice_id">

                        <div class="form-group">
                            <label class="col-sm-2 control-label">发票抬头类型</label>
                            <div class="col-sm-2">
                                <select class="form-control" required name="invoice_title_type" id="invoice_title_type" onchange="changeValue(this.value)">
                                    <option value="1"<if condition="$result['invoice_title_type'] eq 1">selected </if> >个人</option>
                                    <option value="2" <if condition="$result['invoice_title_type'] eq 2">selected </if>>企业</option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">发票类型</label>
                            <div class="col-sm-2">
                                <select class="form-control" required name="invoice_type" id="invoice_type">
                                    <option value="1"<if condition="$result['invoice_type'] eq 1">selected </if> >增值税普通发票</option>
                                    <option value="2" <if condition="$result['invoice_type'] eq 2">selected </if>>增值税专用发票</option>
                                    <option value="3" <if condition="$result['invoice_type'] eq 3">selected </if>>组织增值税普通发票</option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">开票金额</label>
                            <div class="col-sm-10">
                                <input type="text" name="invoice_money" placeholder="请输入开票金额" value="{$result.invoice_money}" class="form-control" required>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">发票抬头</label>
                            <div class="col-sm-10">
                                <input type="text" name="invoice_title" placeholder="请输入抬头" value="{$result.invoice_title}" class="form-control" required>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">发票内容</label>
                            <div class="col-sm-10">
                                <input type="text" name="invoice_content" placeholder="请输入发票内容" value="{$result.invoice_content}" class="form-control" required>
                            </div>
                        </div>

                        <div class="form-group" id="email">
                            <label class="col-sm-2 control-label">用户邮箱</label>
                            <div class="col-sm-10">
                                <input type="text" name="email" placeholder="用户邮箱" value="{$result.email}" class="form-control" required>
                            </div>
                        </div>

                        <div class="form-group" id="address">
                            <label class="col-sm-2 control-label">邮寄地址</label>
                            <div class="col-sm-10">
                                <input type="text" name="address" placeholder="邮寄地址" value="{$result.address}" class="form-control" required>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">是否电子发票</label>
                            <div class="col-sm-2">
                                <select id="is_einvoice" class="form-control" required name="is_einvoice" onchange="changeEinvoice(this.value)">
                                    <option value="0"<if condition="$result['is_einvoice'] eq 0">selected </if> >否</option>
                                    <option value="1" <if condition="$result['is_einvoice'] eq 1">selected </if>>是</option>
                                </select>
                            </div>
                        </div>

                        <div id="company_title_info">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">纳税人识别号</label>
                                <div class="col-sm-10">
                                    <input type="text" name="taxpayer" placeholder="请输入纳税人识别号" value="{$result.taxpayer}" class="form-control" required>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">企业地址</label>
                                <div class="col-sm-10">
                                    <input type="text" name="company_address" placeholder="企业注册地址" value="{$result.company_address}" class="form-control" required>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">企业电话</label>
                                <div class="col-sm-10">
                                    <input type="text" name="company_phone" placeholder="企业电话" value="{$result.company_phone}" class="form-control" required>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">企业开户银行</label>
                                <div class="col-sm-10">
                                    <input type="text" name="bank" placeholder="企业开户银行" value="{$result.bank}" class="form-control" required>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">企业开户银行账号</label>
                                <div class="col-sm-10">
                                    <input type="text" name="bank_account" placeholder="企业开户银行账号" value="{$result.bank_account}" class="form-control" required>
                                </div>
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="submit">保存</button>
                                <a class="btn btn-white" href="{:U('Admin/Invoice/index')}">返回</a>
                            </div>
                        </div>
                        <input type="hidden" value="{$result.image}" id="images">
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__PUBLIC__/Theme1/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/Theme1/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__PUBLIC__/Theme1/js/content.min.js?v=1.0.0"></script>
<script src="__PUBLIC__/Theme1/js/plugins/iCheck/icheck.min.js"></script>
<script>
    $(document).ready(function () {
        //加载页面判断发票抬头类型显示对应的填写项
        if($("#invoice_title_type").val()==1){
            $('#company_title_info').hide();
        }else{
            $('#company_title_info').show();
        }

        if($("#is_einvoice").val()==1){
            $('#address').hide();
        }else{
            $('#email').hide();
        }

    });

    //判断发票抬头类型显示对应的填写项
    function changeValue(v){
        if(v==1){
            $('#company_title_info').hide();
        }else if(v==2){
            $('#company_title_info').show();
        }
    }

    function changeEinvoice(vlues){
        if(vlues==1){
            $('#address').hide();
            $('#email').show();
        }else if(vlues==0){
            $('#email').hide();
            $('#address').show();
        }
    }
</script>
</body>

</html>
